﻿using Admin.NET.Core;
using MOKA.TPM.Entity;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Service.Dto;

/// <summary>
/// 页面输出参数 （设备点检任务）
/// </summary>
public class CheckupTaskOutput : CheckupTask
{
    /// <summary>
    /// TPM设备分组 （字典或人员名称）
    /// </summary>
    public string? TPMDeviceGroupName { get; set; }

    /// <summary>
    /// 任务所属区域 （字典或人员名称）
    /// </summary>
    public string? AreaName { get; set; }

    /// <summary>
    /// 点检周期 （字典或人员名称）
    /// </summary>
    public string? CheckupCycleName { get; set; }

    /// <summary>
    /// 接收人 （字典或人员名称）
    /// </summary>
    public string? ReceiveManName { get; set; }

    /// <summary>
    /// 当前状态 （字典或人员名称）
    /// </summary>
    public string? TaskStatusName { get; set; }

    /// <summary>
    /// 确认人 （字典或人员名称）
    /// </summary>
    public string? ConfirmManName { get; set; }

    /// <summary>
    /// 创建用户 （字典或人员名称）
    /// </summary>
    public string? CreateUserName { get; set; }

    /// <summary>
    /// 更新用户 （字典或人员名称）
    /// </summary>
    public string? UpdateUserName { get; set; }
}

/// <summary>
/// 单ID查询参数
/// </summary>
public class CheckupTaskInput
{
    /// <summary>
    /// 计划ID
    /// </summary>
    public Guid? Id { get; set; }
}

/// <summary>
/// 普通查询参数
/// </summary>
public class GetCheckupTaskInput : BaseOrderInput
{
    /// <summary>
    /// TPM设备分组
    /// </summary>
    public Guid? TPMDeviceGroupId { get; set; }  //唯一索引

    /// <summary>
    /// 任务所属区域
    /// </summary>
    public Guid? Area { get; set; }  //唯一索引

    /// <summary>
    /// 点检周期
    /// </summary>
    public Guid? CheckupCycle { get; set; }  //唯一索引

    /// <summary>
    /// 当前周期
    /// </summary>
    public string? CurrentCycle { get; set; }  //唯一索引
}

/// <summary>
/// 分页查询参数
/// </summary>
public class PageCheckupTaskInput : BasePageInput
{
    /// <summary>
    /// TPM设备分组
    /// </summary>
    public Guid? TPMDeviceGroupId { get; set; }  //唯一索引

    /// <summary>
    /// 任务所属区域
    /// </summary>
    public Guid? Area { get; set; }  //唯一索引

    /// <summary>
    /// 点检周期
    /// </summary>
    public Guid? CheckupCycle { get; set; }  //唯一索引

    /// <summary>
    /// 当前周期
    /// </summary>
    public string? CurrentCycle { get; set; }  //唯一索引
}

/// <summary>
/// 新增记录参数
/// </summary>
public class AddCheckupTaskInput
{
    /// <summary>
    /// TPM设备分组
    /// </summary>
    public Guid TPMDeviceGroupId { get; set; }

    /// <summary>
    /// 任务名称
    /// </summary>
    [Required, MaxLength(100)]
    public string TaskName { get; set; } = string.Empty;

    /// <summary>
    /// 任务所属区域
    /// </summary>
    public Guid Area { get; set; }

    /// <summary>
    /// 点检周期
    /// </summary>
    public Guid CheckupCycle { get; set; }

    /// <summary>
    /// 当前周期
    /// </summary>
    [Required, MaxLength(50)]
    public string CurrentCycle { get; set; } = string.Empty;

    /// <summary>
    /// 设备数量
    /// </summary>
    public int DeviceQty { get; set; }

    /// <summary>
    /// 到期日期
    /// </summary>
    public DateTime TaskDate { get; set; }

    /// <summary>
    /// 接收人
    /// </summary>
    [MaxLength(20)]
    public string? ReceiveMan { get; set; }

    /// <summary>
    /// 接收日期
    /// </summary>
    public DateTime? ReceiveTime { get; set; }

    /// <summary>
    /// 计划开始日期
    /// </summary>
    public DateTime? PlanDateFrom { get; set; }

    /// <summary>
    /// 计划结束日期
    /// </summary>
    public DateTime? PlanDateEnd { get; set; }

    /// <summary>
    /// 任务完成日期
    /// </summary>
    public DateTime? FinishTime { get; set; }

    /// <summary>
    /// 当前状态
    /// </summary>
    public Guid? TaskStatus { get; set; }

    /// <summary>
    /// 确认人
    /// </summary>
    [MaxLength(20)]
    public string? ConfirmMan { get; set; }

    /// <summary>
    /// 确认时间
    /// </summary>
    public DateTime? ConfirmTime { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [MaxLength(200)]
    public string? Remark { get; set; }

    /// <summary>
    /// 创建用户
    /// </summary>
    [Required, MaxLength(20)]
    public string CreateUser { get; set; } = string.Empty;

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 更新用户
    /// </summary>
    [MaxLength(20)]
    public string? UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 子表：点检设备
    /// </summary>
    public List<Checkup> Checkups { get; set; }//一对多
}

/// <summary>
/// 更新参数
/// </summary>
public class UpdateCheckupTaskInput
{
    /// <summary>
    /// 计划ID
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    /// TPM设备分组
    /// </summary>
    public Guid TPMDeviceGroupId { get; set; }

    /// <summary>
    /// 任务名称
    /// </summary>
    [MaxLength(100)]
    public string TaskName { get; set; }

    /// <summary>
    /// 任务所属区域
    /// </summary>
    public Guid Area { get; set; }

    /// <summary>
    /// 点检周期
    /// </summary>
    public Guid CheckupCycle { get; set; }

    /// <summary>
    /// 当前周期
    /// </summary>
    [MaxLength(50)]
    public string CurrentCycle { get; set; }

    /// <summary>
    /// 设备数量
    /// </summary>
    public int DeviceQty { get; set; }

    /// <summary>
    /// 到期日期
    /// </summary>
    public DateTime TaskDate { get; set; }

    /// <summary>
    /// 接收人
    /// </summary>
    [MaxLength(20)]
    public string? ReceiveMan { get; set; }

    /// <summary>
    /// 接收日期
    /// </summary>
    public DateTime? ReceiveTime { get; set; }

    /// <summary>
    /// 计划开始日期
    /// </summary>
    public DateTime? PlanDateFrom { get; set; }

    /// <summary>
    /// 计划结束日期
    /// </summary>
    public DateTime? PlanDateEnd { get; set; }

    /// <summary>
    /// 任务完成日期
    /// </summary>
    public DateTime? FinishTime { get; set; }

    /// <summary>
    /// 当前状态
    /// </summary>
    public Guid? TaskStatus { get; set; }

    /// <summary>
    /// 确认人
    /// </summary>
    [MaxLength(20)]
    public string? ConfirmMan { get; set; }

    /// <summary>
    /// 确认时间
    /// </summary>
    public DateTime? ConfirmTime { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [MaxLength(200)]
    public string? Remark { get; set; }

    /// <summary>
    /// 创建用户
    /// </summary>
    [MaxLength(20)]
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 更新用户
    /// </summary>
    [MaxLength(20)]
    public string? UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 子表：点检设备
    /// </summary>
    public List<Checkup> Checkups { get; set; }//一对多
}

/// <summary>
/// 删除参数
/// </summary>
public class DeleteCheckupTaskInput
{
    /// <summary>
    /// 计划ID
    /// </summary>
    public Guid Id { get; set; }
}

/// <summary>
/// 更新部分数据参数
/// </summary>
public class UpdateSomeCheckupTaskInput
{
    /// <summary>
    /// 计划ID
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    /// TPM设备分组
    /// </summary>
    public string? TPMDeviceGroupId { get; set; }  //唯一索引

    /// <summary>
    /// 任务所属区域
    /// </summary>
    public string? Area { get; set; }  //唯一索引

    /// <summary>
    /// 点检周期
    /// </summary>
    public string? CheckupCycle { get; set; }  //唯一索引

    /// <summary>
    /// 当前周期
    /// </summary>
    public string? CurrentCycle { get; set; }  //唯一索引
}